package cn.changeforyou.web.dao.mybatis.ext.exception;

import cn.changeforyou.base.exception.ErrorInfo;
import cn.changeforyou.base.model.Module;

public enum DaoExceptionEnum implements ErrorInfo {

    CODE_DESIGN_ESTIMATE_NOT_ENOUGH(1, "程序设计预计不足,请联系coder"),
    PAGE_PARAM_ERROR(2, "分页信息异常, size和page都必须大于0"),
    ANNOTATIONS_VALUE_IS_EMPTY(3, "Conditions, Brackets, Betweens 注解使用错误, 禁止传入空数组"),
    ANNOTATION_COMBINE_ERROR(4, "Conditions不能和Condition注解联用"),
    BRACKET_DISUNION(5, "Bracket注解的containsKey和fatherKey不统一"),
    BRACKET_CONFIGURE_FIELD_NOT_EXIST(5, "Bracket配置的字段不存在"),
    CODE_ERROR(6, "编码错误, 该类设计上就不是拿来这么用的"),
    BETWEEN_JUST_SUPPORT_EMPTY_FIELD(7, "between只支持空的字段"),
    ;

    DaoExceptionEnum(int unitCode, String message) {
        this.unitCode = unitCode;
        this.message = message;
    }

    private final int unitCode;
    private final String message;

    @Override
    public String getMessage() {
        return message;
    }

    @Override
    public Module getModule() {
        return Module.DAO_FRAMEWORK;
    }

    @Override
    public int unitCode() {
        return unitCode;
    }

}
